package org.xukai.spark2


import org.apache.spark.SparkContext
import org.apache.spark.sql.SparkSession
import org.apache.spark.util.LongAccumulator
/**
  * @desc
  * @author xukai
  * @date 2017-12-03-下午 8:53
  */
class SparkSqlDemo {

  def main(args: Array[String]): Unit = {
    SparkSession.builder().appName("xukai").master("local").config("spark.sql.warehouse.dir", "D://spark-warehouse").getOrCreate()


  }

  object DroppedWordsCounter {

    @volatile private var instance: LongAccumulator = null

    def getInstance(sc: SparkContext): LongAccumulator = {
      if (instance == null) {
        synchronized {
          if (instance == null) {
            instance = sc.longAccumulator("WordsInBlacklistCounter")
          }
        }
      }
      instance
    }
  }

}
